//
//  DetachedWindowController.swift
//  onemeetingmac
//
//  Created by 张衡 on 2020/6/9.
//  Copyright © 2020 onemeeting. All rights reserved.
//

import Foundation

class DetachedWindowController: NSWindowController, NSWindowDelegate {

    var detachedWindow: NSWindow!
    var isWindow:Bool = false

    override func windowDidLoad() {
        super.windowDidLoad()
        self.detachedWindow.delegate = self
    }

    func windowWillClose(_ notification: Notification) {
        self.isWindow = false
        NSApp.setActivationPolicy(.accessory)
    }

    func windowDidBecomeMain(_ notification: Notification) {
        if NSApp.activationPolicy() == .accessory {
            NSApp.setActivationPolicy(.regular)
        }
    }
}
